%ul.todo-list.sortable
  - tasks.each_with_index do |task, task_index|
    %li.task{ class: ("done" if task.completed), data: {update_position_path: update_position_group_task_path(task.group, task)} }
      = form_for [:complete, task.group, task], html: { class: "complete-task-form" } do |form|
        - if @group.present?
          %span.handle
            = icon 'fa fa-reorder'
        = form.check_box :completed, autocomplete: "off"
        %span.text
          = link_to task.name, [task.group, task]
        - if task.duedate
          %span.label.label-primary
            = icon 'fa fa-calendar'
            = task.duedate.to_s(:date)
        - if task.person
          %span.label.label-primary.hidden-xs
            = icon 'fa fa-user'
            = task.person.name
        - if task.group_scope?
          %span.label.label-primary.hidden-xs
            = icon 'fa fa-user-plus'
            = t("tasks.members")
        - if task.comments.any?
          %span.label.label-default.hidden-xs
            = icon 'fa fa-comment'
            = t("tasks.index.comment_count", count: task.comments.count)
        .tools.show
          - if @logged_in.can_update?(task)
            = link_to edit_group_task_path(task.group, task), class: 'btn bg-gray btn-xs text-yellow' do
              = icon 'fa fa-pencil'
          - if @logged_in.can_delete?(task)
            = link_to task, data: { method: 'delete', confirm: t('are_you_sure') },  class: 'btn bg-gray btn-xs text-red' do
              = icon 'fa fa-minus-circle'
